#ifndef BSP_EFM_H
#define BSP_EFM_H
#include "hc32_ll.h"

#define ADDR_PARA       0x3E000
#define ADDR_APPVERSION 0x3E000
#define APP_BASE_ADDR   0x40000
/* Boot configuration */
#define IAP_BOOT_SIZE                               (0x8000UL)
/* APP configuration */
#define APP_EXIST_FLAG_ADDR                         (EFM_BASE + IAP_BOOT_SIZE - 4U)
#define APP_UPGRADE_FLAG_ADDR                       (EFM_BASE + IAP_BOOT_SIZE - 8U)
#define APP_RUN_ADDR                                (EFM_BASE + IAP_BOOT_SIZE - 12U)
typedef union
{
    uint8_t data8[8192];
    uint16_t data16[4096];
    uint32_t data32[2048];
}EFM_data_t;

uint8_t WriteAppVersion(uint32_t version);
void erase_parameter(void);
uint32_t GetVersion(void);
#ifdef __cplusplus
};
#endif

#endif
